// 每日数据统计
<template>
  <div
    class="page-container page-container-havePagination"
    :class="{'page-container-haveFooter':$store.state.settings.showFooter}"
  >
    <div class="head-search-container">
      <!-- 搜索 -->
      <el-form
        :inline="true"
        label-position="right"
        label-width="74px"
        size="small"
        :model="searchQuery"
        class="demo-form-inline"
      >
        <el-form-item label="日期筛选">
          <el-date-picker
            class="search-btn"
            size="small"
            v-model="time"
            @change="changeDate"
            type="daterange"
            value-format="yyyy-MM-dd"
            range-separator="至"
            :clearable="false"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button size="small" type="success" class="greenColor" @click="search">查询</el-button>
          <el-button size="small" @click="reloadSearch">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <!-- 表格渲染 -->
    <el-table
      header-row-class-name="table-header-style"
      :row-class-name="tableRowStyle"
      :data="tableData"
      tooltip-effect="dark"
      style="width: 100%"
      show-summary
      v-loading="loading"
    >
      <el-table-column type="index" label="序号" width='60px'></el-table-column>
      <el-table-column prop="orgName" label="机构名称" width="180px"></el-table-column>
      <el-table-column prop="registerNum" label="注册量" show-overflow-tooltip></el-table-column>
      <el-table-column prop="gh" label="挂号" show-overflow-tooltip></el-table-column>
      <el-table-column prop="zd" label="诊断" show-overflow-tooltip></el-table-column>
      <el-table-column prop="kf" label="开方" show-overflow-tooltip></el-table-column>
      <el-table-column prop="qy" label="取药" show-overflow-tooltip></el-table-column>
      <el-table-column prop="jc" label="检查" show-overflow-tooltip></el-table-column>
      <el-table-column prop="sh" label="手术" show-overflow-tooltip></el-table-column>
      <el-table-column prop="sf" label="收费" show-overflow-tooltip></el-table-column>
      <el-table-column prop="qt" label="其他" show-overflow-tooltip></el-table-column>
    </el-table>
  </div>
</template>
<script>
import { setSearchValue } from "@/utils/index";
import initData from "@/mixins/req";
import store from "@/store";
export default {
  name: "Day",
  mixins: [initData],
  data() {
    return {
      searchQuery: {
        startTime: "", // 开始时间
        endTime: "" //结束时间
      }
    };
  },
  created() {
    this.setDefaultValue();
    this.search();
  },
  methods: {
    search() {
      this.init().then(res => {
        this.tableData = res.data;
      });
    },
    reloadSearch() {
      setSearchValue(this, this.searchQuery);
      this.setDefaultValue();
      this.search();
    },
    beforeInit() {
      this.url = store.getters["api/dailyData"];
      this.searchParams = {
        ...this.searchQuery
      };
      return true;
    }
  }
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
@import "~@/assets/styles/page.scss";
@import "~@/assets/styles/table.scss";
</style>
